package com.hao.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;



import com.hao.service.productservice;
import com.hao.serviceImpl.productserviceImpl;

import static java.lang.System.out;

/**
 * Created by Administrator on 2018/7/31.
 */
public class Servletsc extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


        int id=Integer.parseInt(request.getParameter("id"));

        productservice vv=new productserviceImpl();
            int i=vv.dele(id);
      if(i>0){

          response.sendRedirect("Servletdele");

      }else{
          out.print("<script language='javascript'>history.go(-1);alert('删除失败');</script>");
      }


    }
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}
